//
//  RACView.m
//  ReactiveCocoa
//
//  Created by apple on 2017/9/9.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "RACView.h"

@implementation RACView

- (instancetype)init{
    
    self = [super init];
    
    if (self) {
        
        [self createUI];
        
    }
    
    return self;
}


- (void)createUI{

    self.backgroundColor = [UIColor blueColor];
    
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0 , 100, 50)];
    
    [btn setTitle:@"点击" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
    
    [btn addTarget:self action:@selector(Click:) forControlEvents:UIControlEventTouchUpInside];
    
    btn.backgroundColor = [UIColor redColor];
    
    [self addSubview:btn];
    
    self.btn = btn;
    
    
    
}

- (void)Click:(UIButton *)sender{
    
    NSArray *arr = @[@"我", @"烯", @"烯烯"];

    
    //发送信号
    [self.viewSignal sendNext:arr];
    
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"RACView" object:nil userInfo:@{@"RACView" : @"我只是测试下"}];
}


//懒加载 - 冷信号
- (RACSubject *)viewSignal{

    if (_viewSignal == nil) {
        
        _viewSignal = [RACSubject subject];
        
    }
    
    return _viewSignal;
}

@end
